package view.component.monster.large_monster
{
	import enums.main.UISize;
	
	import feathers.controls.Label;
	import feathers.data.ListCollection;
	
	import model.vo.monster.LMonsterSpEffectVo;
	
	import view.component.BaseSCListView;
	import view.render.monster.LMonsterSpListItem;
	
	/**
	 * 大型怪物详细-特殊效果界面
	 * @author £iang
	 * 
	 */	
	public class LMDetailSpEffectView extends BaseSCListView
	{
		//-----------------------------
		// variables
		//-----------------------------
		
		/** 毒标题  */
		public var poisonTitle:Label;
		/** 麻痹标题  */
		public var palsyTitle:Label;
		/** 睡眠标题  */
		public var sleepTitle:Label;
		/** 眩晕标题  */
		public var dizzyTitle:Label;
		/** 灭气标题  */
		public var fatigueTitle:Label;
		
		//-----------------------------
		// properties
		//-----------------------------
		
		//-----------------------------
		// setter&getter
		//-----------------------------
		
		//-----------------------------
		// methods
		//-----------------------------
		
		/**
		 * 初始化函数 
		 * 
		 */		
		override protected function initialize():void
		{ 
			_itemH = UISize.LMONSTER_SE_ITEM_H * this.dpiScale;
			_listH = UISize.MAIN_H - 
				( UISize.MONSTER_TAB_AREA_H + 
					UISize.LMONSTER_DETAIL_TAB_AREA_H +
					UISize.LIST_TITLE_H) * this.dpiScale;
			_scrollerMaxPage = 1;
			_firstName = "属性";
			super.initialize();
		}
		
		override protected function initializeOther():void
		{
			super.initializeOther();
			poisonTitle = new Label();
			poisonTitle.text = "毒";
			poisonTitle.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( poisonTitle );
			
			palsyTitle = new Label();
			palsyTitle.text = "麻痹";
			palsyTitle.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( palsyTitle );
			
			sleepTitle = new Label();
			sleepTitle.text = "睡眠";
			sleepTitle.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( sleepTitle );
			
			dizzyTitle = new Label();
			dizzyTitle.text = "眩晕";
			dizzyTitle.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( dizzyTitle );
			
			fatigueTitle = new Label();
			fatigueTitle.text = "灭气";
			fatigueTitle.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( fatigueTitle );
		}
		
		/**
		 * 绘制函数 
		 * 
		 */		
		override protected function draw():void
		{
			var labelY:Number = ( UISize.LIST_TITLE_H - 
				43 ) / 2 * this.dpiScale;
			var leftPadding:Number = UISize.TITLE_PADDING_LEFT * this.dpiScale;
			var firstTitleFullW:Number;
			
			firstTitle.y = labelY;
			firstTitle.x = leftPadding;
			firstTitleFullW = UISize.MAIN_W / 4;
			firstTitle.width = firstTitleFullW - leftPadding;
			
			scollerContainer.x = firstTitleFullW;
			scollerContainer.width = UISize.MAIN_W - firstTitleFullW;
			scollerContainer.height = UISize.LIST_TITLE_H;
			
			poisonTitle.y = labelY;
			poisonTitle.x = 0;
			poisonTitle.width  = UISize.MAIN_W / 4;
			
			palsyTitle.y = labelY;
			palsyTitle.x = UISize.MAIN_W / 4;
			palsyTitle.width  = UISize.MAIN_W / 4;
			
			sleepTitle.y = labelY;
			sleepTitle.x = UISize.MAIN_W / 2;
			sleepTitle.width  = UISize.MAIN_W / 4;
			
			dizzyTitle.y = labelY;
			dizzyTitle.x = UISize.MAIN_W * 3 / 4;
			dizzyTitle.width  = UISize.MAIN_W / 4;
			
			fatigueTitle.y = labelY;
			fatigueTitle.x = UISize.MAIN_W;
			fatigueTitle.width  = UISize.MAIN_W / 4;
			
			var buttonY:Number = ( UISize.LIST_TITLE_H * this.dpiScale - leftButton.height ) / 2;
			
			leftButton.x = firstTitleFullW - leftButton.width;
			leftButton.y = buttonY;
			
			rightButton.x = UISize.MAIN_W - leftButton.width;
			rightButton.y = buttonY;
			
			list.y = UISize.LIST_TITLE_H * this.dpiScale;
		}
	
		/**
		 * 设置列表数据 
		 * @param dataVec 数据
		 * 
		 */		
		public function setListData( dataVec:Vector.<LMonsterSpEffectVo> ):void
		{
			var i:int;
			var len:int = dataVec.length;
			
			_listData = new ListCollection([]);
			
			for( i = 0; i < len; i++)
			{
				var item:LMonsterSpListItem = new LMonsterSpListItem();
				var tmpData:LMonsterSpEffectVo = dataVec[ i ] as LMonsterSpEffectVo;
				
				item.setData( tmpData );
				_listData.push( { item:item, itemData:tmpData } );
			}
			
			list.dataProvider = _listData;
		}
		
		//-----------------------------
		// events
		//-----------------------------
		
		//-----------------------------
		// dispose
		//-----------------------------
		
		/**
		 * 析构函数 
		 * 
		 */		
		protected override function disposeAnythingInContainer():void
		{
			disposeLabels( [
				"poison", "palsy", "sleep",
				"dizzy", "fatigue"
			] );
		}
		
		//-----------------------------
		// construction
		//-----------------------------
		
		/**
		 * 构造函数
		 *
		 */
		public function LMDetailSpEffectView()
		{
		}
	}
}